<?php

declare(strict_types=1);

namespace App\Listener;

use App\Event\UserRegistered;
use Hyperf\Event\Annotation\Listener;
use Hyperf\Event\Contract\ListenerInterface;

/**
 * 用户注册事件监听器
 * Class UserRegisteredListener
 * @package App\Listener
 * @Listener()
 */
class UserRegisteredListener implements ListenerInterface
{

    /**
     * @inheritDoc
     */
    public function listen(): array
    {
        // TODO: Implement listen() method.
        // 返回一个该监听器要监听的事件数组，可以同时监听多个事件
        return [
            UserRegistered::class,
        ];
    }

    /**
     * @inheritDoc
     */
    public function process(object $event)
    {
        // TODO: Implement process() method.
        echo json_encode($event);
        echo ("发短信");
        echo ("发邮件");
        echo ("发消息通知");
    }
}
